package epam.lab.spring.bean;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Bean Example (Simple POJO)
 * @author Iurii Miedviediev
 * @version 1.0 Build 22.08.2014
 */
public class Student {

    private String id;
    private String name;
    private Homework homework;
    private static final Logger LOGGER = LoggerFactory.getLogger(Student.class);

    public Student() {
    }

    public Student(Homework hw) {
        this.homework = hw;
    }

    public Student(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public Student(String name, Homework hw) {
        this.name = name;
        this.homework = hw;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Homework getHomework() {
        return homework;
    }

    public void setHomework(Homework homework) {
        this.homework = homework;
    }

    public boolean doHomework() {
        if(this.homework == null) {
            LOGGER.info("No hometasks for student " + name);
            return false;
        } else {
            LOGGER.info("Doing " + this.homework.getTask());
            return true;
        }
    }
}
